<extend name='Public/index'/>
<block name='content'>
	<div class="row">
	<form action="?" method="post" id='form'>
		<div class="medium-4 columns">
			<select name="up" id="sItem">
				<volist name='b' id='examType'>
					<option value="<{$examType.id}>"><{$examType.exam_name}></option>
				</volist>
			</select>
		</div>
		<div class="medium-4 columns">
			<select name="term_id" id="term">
				<volist name='term' id='term'>
					<option value="<{$term.val}>"><{$term.val}></option>
				</volist>
			</select>
		</div>
		<input type="submit">
	</form>	
	</div>
	<div class='row' id='examTable'>
	<form id='mark' method='post' action=<{:U('doAddExam')}>>
	<table contenteditable="true" class='medium-12 columns'>
	<thead>
	<tr>
					<th>姓名</th>
					<volist name='item' id='articleTitle'>
						<th><{$articleTitle.exam_name}></th>
					</volist>
				</tr>
				</thead>
				<tbody>
				<volist name='student' id='studentInfo'>
					<tr index='<{$studentInfo.student_id}>'>
					<th><{$studentInfo.sname}></th>
					<volist name='item' id='articleTitle'>
						<td><input id='<{$articleTitle.id}>' type='text'></td>	
						<input type='hidden' name='json' id='json'>
					</volist>
					</tr>
				</volist>
				</tbody>
	</table>
	<input type='button' value='提交' onclick='tj()'>
	</form>
	</div>
	<script>
	function tj(){
		tijiao();
	}
	
	var str='';
	function tijiao(){
	$('tbody tr').map(function(){
			
		var a=$(this).attr('index');
		//console.log($(this).find('th').html());
		$(this).find('td').map(function(){

			var b=$(this).find('input').val();
			var c=$(this).find('input').prop('id');
			str ='{"student_id":'+a+',"score":"'+b+'","type_dict_id":'+c+'}';
			//str = JSON.stringify(arr[index]);
			obj = $('<input type="hidden" name="val[]">').val(str);;
			$('form').append(obj);	
		});
		
	});
	//console.log(typeof(str));
		$('#mark').submit();
	}
	</script> 

	
</block>